package br.com.moxeon.view.composer;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.annotation.Scope;
import org.zkoss.zk.ui.Component;

import br.com.moxeon.control.BankController;
import br.com.moxeon.control.ThirdCheckController;
import br.com.moxeon.model.Bank;
import br.com.moxeon.model.financialitems.ThirdCheck;
import br.com.vexillum.util.ReflectionUtils;
import br.com.vexillum.util.SpringFactory;

@SuppressWarnings("serial")
@org.springframework.stereotype.Component
@Scope("prototype")
public class ThirdCheckComposer extends CheckComposer<ThirdCheck, ThirdCheckController>{
	
	@Override
	public void doAfterCompose(Component comp) throws Exception{
		super.doAfterCompose(comp);
		loadBinder();
	}
	
	@Override
	public ThirdCheckController getControl() {
		return SpringFactory.getController("thirdCheckController", ThirdCheckController.class, ReflectionUtils.prepareDataForPersistence(this));
	}

	@Override
	public ThirdCheck getEntityObject() {
		return new ThirdCheck();
	}
			
	@Override
	protected String getUpdatePage() {
		return "/paginas/cheque/cheque_proprio/modalCadastrar.zul";
	}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public List getBanks(){
		List list = (ArrayList<Bank>) SpringFactory.getController("bankController", BankController.class, null).listAll().getList();		return list;
	}
}